package com.woniuxy.controller;

import com.woniuxy.entity.Mail;
import com.woniuxy.service.ProducerConsumserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * @Author: 马宇航
 * @Description: 生产者消费者模型的controller
 * @DateTime: 22/10/19/0019 16:44
 * @Component: 成都蜗牛学苑
 **/
@Controller
public class ProducerConsumerController {
    @Autowired
    ProducerConsumserService producerConsumserService;
    @ResponseBody
    @PostMapping (value = "/produce", produces = {"application/json;charset=UTF-8"})
    public void produce(@ModelAttribute("mail") Mail mail){
        producerConsumserService.sendEmail("ProConQueue",mail);
    }
}
